Total Complexity | 7 |
Total Lines | 64 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import { |
||
14 | |||
15 | @Entity() |
||
16 | export class Photo { |
||
17 | @PrimaryGeneratedColumn('uuid') |
||
18 | private id: string; |
||
19 | |||
20 | @Column('enum', { enum: PhotoType, nullable: false }) |
||
21 | private type: PhotoType; |
||
22 | |||
23 | @Column({ type: 'varchar', nullable: false }) |
||
24 | private name: string; |
||
25 | |||
26 | @Column({ type: 'varchar', nullable: false }) |
||
27 | private path: string; |
||
28 | |||
29 | @Column({ type: 'varchar', nullable: false }) |
||
30 | private token: string; |
||
31 | |||
32 | @Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' }) |
||
33 | private createdAt: Date; |
||
34 | |||
35 | @ManyToOne(() => Classroom, { nullable: false, onDelete: 'CASCADE' }) |
||
36 | private classroom: Classroom; |
||
37 | |||
38 | constructor( |
||
39 | type: PhotoType, |
||
40 | name: string, |
||
41 | path: string, |
||
42 | token: string, |
||
43 | classroom: Classroom |
||
44 | ) { |
||
45 | this.type = type; |
||
46 | this.name = name; |
||
47 | this.path = path; |
||
48 | this.token = token; |
||
49 | this.classroom = classroom; |
||
50 | } |
||
51 | |||
52 | public getId(): string { |
||
53 | return this.id; |
||
54 | } |
||
55 | |||
56 | public getType(): PhotoType { |
||
57 | return this.type; |
||
58 | } |
||
59 | |||
60 | public getName(): string { |
||
61 | return this.name; |
||
62 | } |
||
63 | |||
64 | public getPath(): string { |
||
65 | return this.path; |
||
66 | } |
||
67 | |||
68 | public getToken(): string { |
||
69 | return this.token; |
||
70 | } |
||
71 | |||
72 | public getCreatedAt(): Date { |
||
73 | return this.createdAt; |
||
74 | } |
||
75 | |||
76 | public getClassroom(): Classroom { |
||
77 | return this.classroom; |
||
78 | } |
||
80 |